//
//  ViewController.m
//  饼线柱状图
//
//  Created by ma c on 6/8/18.
//  Copyright © 2018年 子房. All rights reserved.
//

#import "ViewController.h"
#import "PieChartViewController.h"
#import "BarChartViewController.h"

#import "SSWPieChartView.h"

@interface ViewController ()<SSWChartsDelegate,UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *homeTable;
@property(nonatomic,strong)NSMutableArray *dataArr;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _homeTable = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    _homeTable.estimatedRowHeight = 500;
    _homeTable.delegate = self;
    _homeTable.dataSource = self;
    _homeTable.separatorStyle = UITableViewCellSeparatorStyleNone;
    _homeTable.backgroundColor = [UIColor whiteColor];
    _homeTable.estimatedSectionHeaderHeight = 0;
    _homeTable.estimatedSectionFooterHeight = 0;
    [self.view addSubview:_homeTable];
    
    self.dataArr = [@[@"PieChartViewController",
                      @"BarChartViewController",
                      @"LinChartViewController",
                      @"MutipleBarChartViewController",
                      @"MutipleLineChartViewController"] mutableCopy];

//    [self getTheDevColor];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.dataArr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
    }
    cell.textLabel.text = self.dataArr[indexPath.row];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString  *className =self.dataArr[indexPath.row];
    UIViewController  *vc = [[NSClassFromString(className) alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
